package cn.org.donald.base;

import java.io.Serializable;

/**
 * @author : Donald
 * @since : 2021/3/17 13:32
 */
public class ServiceException extends RuntimeException implements Serializable {

    private Integer code;

    private String info;

    public ServiceException() {
        super();
    }

    public ServiceException(Integer code, String message) {
        super(message);
        this.code = code;
        this.info = message;
    }


    public ServiceException(String message) {
        super(message);
        this.code = 500;
        this.info = message;
    }

    public ServiceException(String message, Throwable cause) {
        super(message, cause);
    }

    public ServiceException(Throwable cause) {
        super(cause);
    }

    protected ServiceException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }
}
